// pages/myMemCardDetail/myMemCardDetail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    memCardDetail: {
      memCard: '../../images/memCard.png',
      applyForMem: '/applyForMem.wxml'
    },
    hideProtocol: true,
    isOpened: 0,
    modalId: 'one',
    showCancel: true,
    atBottom: false,
    redBag: 'http://sjt-file.b0.upaiyun.com/wxgzh/hongbao1.png',
    disappear: true
  },

  /**
   * 续费
   */
  rewew: function (e) {
    var that = this
    that.setData({
      hideProtocol: !that.data.hideProtocol,
      atBottom: false
    })
  },

  /**
   * 升级
   */
  upgrade: function (e) {
    var that = this
    that.setData({
      //hideProtocol: !that.data.hideProtocol,
      //atBottom: false
      disappear: false
    })
    // wx.navigateTo({
    //   url: '../myPrivilegeUpgrade/myPrivilegeUpgrade'
    // })
  },

  /**
   * 立即开通
   */
  applyFor: function (e) {
    var that = this
    that.setData({
      hideProtocol: !that.data.hideProtocol,
    })
  },
  
  /**
   * 滚动至底部
   */
  atBottom: function () {
    var that = this
    that.setData({
      atBottom: true,
    })
  },

  /**
   * 同意协议
   */
  iAgree: function (e) {
    var that = this
    if (this.data.atBottom) {
      wx.navigateTo({
        url: '../orderStep/orderStep'
      })
    }
  },

  /**
   * 点击空白处关闭
   */
  clickBlank: function (e) {
    var id = e.target.id
    console.log(id)
    var that = this
    if (id == 'one') {
      this.setData({
        hideProtocol: true,
      })
    }
  },

  /**
   * 关闭
   */
  closeReward: function () {
    var that = this
    that.setData({
      disappear: true
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      isOpened: options.isOpened
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})